package edu.hzit.data.controller;

import edu.hzit.data.entity.Memorandum;
import edu.hzit.data.service.MemorandumService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("memorandum")
public class MemorandumController{
    @Resource
    private MemorandumService memorandumService;

    @RequestMapping("insert")
    private int insert(Memorandum memorandum) {
        return memorandumService.insert(memorandum);
    }

    @RequestMapping("loadList")
    private List<Memorandum> loadList() {
        return memorandumService.loadList();
    }

    @RequestMapping("selectById")
    private Memorandum selectById(int bId) {
        return memorandumService.selectById(bId);
    }

    @RequestMapping("delete")
    private int delete(int bId) {
        return memorandumService.delete(bId);
    }

    @RequestMapping("update")
    private int update(Memorandum memorandum) {
        return memorandumService.update(memorandum);
    }

    @RequestMapping("fuzzySearch")
    private List<Memorandum> fuzzySearch(String content) {
        return memorandumService.fuzzySearch(content);
    }
}
